'use strict';

 module.exports = function collectSameElements(collectionA, collectionB) {
  var arr=[];
  var b=[];
  let c=(collectionB+'').split(',');
  // for(let item of collectionB){
  //   arr.push(item);
  // }
  console.log(c);
  for(let s1=0;s1<collectionA.length;s1++){
    for(let s2=0;s2<c.length;s2++){
      if(collectionA[s1]==c[s2]){
                  b.push(collectionA[s1]);
      }
    }
  }
  console.log(b);
  return b;
}
// const collectionA = ['a', 'e', 'h', 't', 'f', 'c', 'g', 'b', 'd'];
// const collectionB = [['a', 'd', 'e', 'f']];
// console.log(collectSameElements(collectionA, collectionB))

//nsole.log(( ([['a', 'd', 'e', 'f']])+'').split(','));